package com.dcbeida.activity;

import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.dcbeida.R;
import com.just.agentweb.AgentWeb;

import butterknife.Bind;
import butterknife.OnClick;


/**
 * 帮助手册
 */
public class HelpActivity extends BaseActivity {


    @Bind(R.id.img_back)
    ImageView imgBack;
    @Bind(R.id.tv_title)
    TextView tvTitle;

    @Bind(R.id.lin_wb)
    LinearLayout lin_wb;

    private AgentWeb mAgentWeb;

    @Override
    protected int getLayoutResId() {
        return R.layout.activity_help;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initData();

    }

    private void initData(){
        tvTitle.setText("帮助手册");
        mAgentWeb = AgentWeb.with(this)
                .setAgentWebParent((LinearLayout) lin_wb, new LinearLayout.LayoutParams(-1, -1))
                .useDefaultIndicator()
                .createAgentWeb()
                .ready()
                .go("https://wg.bettapharma.cn/apiv2/AppHelp.html");

    }

    @OnClick(R.id.img_back)
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.img_back:
                finish();
                break;
        }
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {

        if (mAgentWeb.handleKeyEvent(keyCode, event)) {
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }
}
